<?php header("Content-Type:text/html;   charset=utf-8"); ?>
<script type="text/javascript">
	$(function(){
		$("a[href='#maximize']").trigger("click");	
		//$("#txtRealNameCard,#selSexCard,#txtBirthDayCard,#txtPhoneCard,#txtEmailCard,#txtCardTypeCard,#txtCardNoCard).attr("disabled","disabled");
		$("#tableCard input,#tableCard select").attr("readonly","readonly").attr("disabled","disabled");
		loadUserCard();		
		$("#btnSubmitPassCard").bind("click",function(){submit(3);});
		$("#btnSubmitDenyCard").bind("click",function(){submit(4);});
	});	
	
	function submit(status){
		var params = {
					id:$("#hduid").val(),
					idcardstatus:status,
					idcardremark:$("#txtIdCardRemarkCard").val()
				};	
		$.ajax({
			type:"post",
			url:"admin.php/manage/modifyIdCard",
			dataType:"json",
			data:params,
			success:function(data){
				parent.loadUser();
				alert("操作成功");
				$("#btnCloseCard").trigger("click");
			}
		});
	}
	
	function loadUserCard(){
		var id = $("#hduid").val();
		var params = {id:id};
		$.ajax({
			type:"post",
			url:"admin.php/manage/getUserInfoById",
			dataType:"json",
			data:params,
			success:function(data){
				$("#txtRealNameCard").val(data.realname);
				$("#selSexCard").val(data.sex);
				$("#txtBirthDayCard").val(data.birthday);
				$("#txtPhoneCard").val(data.phone);
				$("#txtEmailCard").val(data.email);
				$("#txtCardTypeCard").val(data.idcardtypename);
				$("#txtCardNoCard").val(data.idcardno);
				$("#txtCardStatusCard").val(data.idcardstatusname);
				$("#txtCardTimeCard").val(data.idcardtime);
				$("#txtIdCardRemarkCard").val(data.idcardremark);
				$("#imgIdCardUrlCard").attr("src",data.idcardurl);
				$("#imgIdCardUrl2Card").attr("src",data.idcardurl2);
			}
		});
	}
	
	function loadCity(p,c){
		$("#"+c).html("<option value=''>请选择...</option>");
		var pid = $("#"+p).val();
		if(IsEmpty(pid))
			return;
		var params = {provinceid : pid};
		$.ajax({
			type:"post",
			url:"admin.php/City/getByProvinceId",
			dataType:"html",
			data:params,
			async:false,
			success:function(data){
				$("#"+c).append(data);
			}
		});
	}
	function basicCard(){
			var id = $("#hduid").val();
			$("#hrefEditUserManage").attr("href","admin.php/manage/newuser?id="+id).text("基本信息");
			$("#hrefEditUserManage").trigger("click");
	}
	function albumCard(){
		var id = $("#hduid").val();
		$("#hrefEditUserManage").attr("href","admin.php/manage/album?id="+id).text("相册管理");
		$("#hrefEditUserManage").trigger("click");
	}
	function rzCard(){
		var id = $("#hduid").val();
		$("#hrefEditUserManage").attr("href","admin.php/manage/auditCard?id="+id).text("认证管理");
		$("#hrefEditUserManage").trigger("click");
	}
</script>
<div class="pageContent">
	<form class="pageForm required-validate"
		onsubmit="return validateCallback(this, navTabAjaxDone);">
		<div class="panelBar">
			<ul class="toolBar">

				<li style="display: none"><a id="hrefEditUserManage" class="edit"
					href="" lookupgroup="orgLookup"><span>修改</span></a></li>
				<li><a id="hrefDel" onclick="basicCard()" class="delete" href="javascript:void(0)"><span>基本信息</span></a></li>
				<li><a id="hrefExport" onclick="albumCard()" class="edit" href="javascript:void(0)"><span>相册管理</span></a></li>
				<li><a id="hrefExport" onclick="rzCard()" class="edit" href="javascript:void(0)"><span>认证管理</span></a></li>
			</ul>
		</div>
		<div class="pageFormContent" style="float: left; width: 100%;"
			layoutH="56">
			<table>
				<tr>
					<td>
						<table class="tableNewUser" id="tableCard" style="width: 500px; vertial-align:top;">
							<tr>
								<td>电话：</td>
								<td><input id="txtPhoneCard" type="text" value="" /></td>
							</tr>
							<tr>
								<td>邮箱：</td>
								<td><input id="txtEmailCard" type="text" value="" /></td>
							</tr>

							<tr>
								<td>姓名：</td>
								<td><input type="text" id="txtRealNameCard" /></td>
							</tr>
							<tr>
								<td>性别：</td>
								<td><select id="selSexCard" style="width: 120px">
										<option value="男">男</option>
										<option value="女">女</option>
								</select></td>
							</tr>
							<tr>
								<td>出生年月：</td>
								<td><input type="text" id="txtBirthDayCard" value=""></td>
							</tr>
							<tr>
								<td>证件类型：</td>
								<td><input type="text" id="txtCardTypeCard" /></td>


							</tr>
							<tr>
								<td>证件号码：</td>
								<td><input type="text" id="txtCardNoCard" /></td>
							</tr>
							<tr>
								<td>认证时间：</td>
								<td><input type="text" id="txtCardTimeCard"></td>
							</tr>
							<tr>
								<td>认证状态:</td>
								<td><input type="text" id="txtCardStatusCard"></td>
							</tr>
							<tr>
								<td colspan="2"></td>
							</tr>
						</table>
					</td>
					<td>
						<table class="tabCard" style="float: left; width: 500px;">
							<tr>
								<td><img id='imgIdCardUrlCard' src=''
									style="width: 320px; height: 200px" /></td>
								<td style="margin-left: 20px"><img id='imgIdCardUrl2Card' src=''
									style="width: 320px; height: 200px" /></td>
							</tr>
							<tr>
								<td style="line-height:30px" colspan="2"><b>备注</b></td>
							</tr>



							<tr>
							<td colspan="2"> <textarea id="txtIdCardRemarkCard"
									style="width: 630px; height: 80px"></textarea></td>
							</tr>

							<tr>
								<td colspan="2" style="line-height: 60px">

									<div class="buttonActive"
										style="width: 120px; margin-left: 80px; ">
										<div class="buttonContent">
											<button id="btnSubmitPassCard" type="button"
												style="width: 80px">通过认证</button>
										</div>
									</div>

									<div class="button">
										<div class="buttonContent">
											<button id="btnSubmitDenyCard" type="button"
												style="width: 80px">驳回认证</button>
										</div>
									</div>

									<div class="button" style="margin-left: 20px">
										<div class="buttonContent">
											<button id="btnCloseCard" type="button" class="close"
												style="width: 80px">取 消</button>
										</div>
									</div>


								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>


			<input type="hidden" id="hduid"
				value="<?php if(isset($_GET["id"])) print $_GET["id"]; else print 0;?>">


		</div>

		<div class="pageFormContent"
			style="float: right; width: 460px; overflow: auto;" layoutH="56"
			id="divExistsNew"></div>
	</form>
</div>
